<?php
	class validation
	{
		public $target;
		public $message;
		public $status;
		
		public function __construct()
		{
			$this->subject = '';
			$this->message = '';
			$this->status = 0;
		}
		
		public function isEmailAddress($subject, $message)
		{
			$this->subject = $subject;
			if (filter_var($subject, FILTER_VALIDATE_EMAIL))
			{
				return '';
			}
			$this->message = $message;
			$this->status += 1;
			return $this->message;
		}
		
		public function isCreditCardNo($subject, $message)
		{
			$this->subject = $subject;
			if (preg_match('/^[0-9]{16}$/',$subject))
			{
				return '';
			}
			$this->message = $message;
			$this->status += 1;
			return $this->message;
		}
		
		public function isDate($subject, $message)
		{
			$this->subject = $subject;
			if (preg_match('/^([0-9]){3}$/',$subject))
			{
				return '';
			}
			$this->message = $message;
			$this->status += 1;
			return $this->message;
		}

		public function isListItemSelected($subject, $message)
		{
			$this->subject = $subject;
			if ($subject != 0)
			{
				return '';
			}
			$this->message = $message;
			$this->status += 1;
			return $this->message;
		}		
	
		public function isEmpty($subject, $message)
		{
			$this->subject = $subject;

			if ($subject == '' && empty($subject))
			{
				$this->message = $message;
				$this->status += 1;
				return $this->message;
			}
			return false;
		}
		
		public function isPasswordMatch($subject1,$subject2, $message)
		{
			if ($subject1 !== $subject2)
			{
				$this->message = $message;
				$this->status += 1;
				return $this->message;
			}
			return false;
		}
		
		public function isNumeric()
		{
			$this->subject = $subject;
			if (preg_match('/^[0-9]{11}$/',$subject))
			{
				return '';
			}
			$this->message = $message;
			$this->status += 1;
			return $this->message;
		}
		
	}
?>